package cn.iscorpio.ssm.controller;

import cn.iscorpio.ssm.model.po.User;
import cn.iscorpio.ssm.service.IUserService;
import cn.iscorpio.ssm.web.RestResponse;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenkx
 * @date 2018-05-04.
 */
@RestController
@RequestMapping
public class UserController {

    @Autowired
    IUserService IUserService;

    @GetMapping("pages/{pageIndex}/{pageSize}")
    public RestResponse<PageInfo<User>> getUserInfo(@PathVariable Integer pageIndex, @PathVariable Integer pageSize) {
        final PageInfo<User> pageInfo = IUserService.listAsPage(null, pageIndex, pageSize);
        return RestResponse.success(pageInfo);
    }
}
